@Counter
<br />
<button type="button" @onclick="Increment">Increment</button>

<ul>
@foreach(var l in List){
    <li @key="l">@l</li>
}
</ul>

<button type="button" @onclick="AddToList">Add to List</button>

@code {
    int Counter {get; set;}
    List<int> List {get;set;} = new List<int>();
        
    Random _rand = new Random();
    
    public void AddToList()
    {
        List.Add(_rand.Next(10000));
    }

    public void AddToListStateHasChanged()
    {
        List.Add(_rand.Next(10000));
        this.StateHasChanged();
    }

    public void Increment()
    {
        Counter = Counter + 1;
    }

    public void IncrementWithStateHasChanged()
    {
        Counter++;
        this.StateHasChanged();
    }
}